﻿using System;
using System.ComponentModel;

namespace 小说爬取
{
    /// <summary>
    /// 小说异步解析接口
    /// </summary>
    public interface IBeginParse : IFictionInfi
    {
       

        /// <summary>
        /// 异步 解析章节列表
        /// </summary>
        void BeginParse();

        /// <summary>
        /// 异步下载小说
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        void BeginDownload(int num);

        /// <summary>
        /// 写出小说
        /// </summary>
        /// <param name="num"></param>
        /// <param name="err"></param>
        /// <returns></returns>
        void BeginWrite(string path);

        /// <summary>
        /// 回调事件
        /// </summary>
        event EventHandler<MessageEventArgs> Message;
    }

    public class MessageEventArgs : EventArgs
    {
        /// <summary>
        /// 状态成功或失败
        /// </summary>
        public bool State { get; set; }

        /// <summary>
        /// 回调类型
        /// </summary>
        public MessageType Type { get; set; }

        /// <summary>
        /// 消息
        /// </summary>
        public string Message { get; set; }
    }

    public enum MessageType : byte
    {
        /// <summary>未知状态</summary>

        [Description("未知状态")]
        Unknown,

        /// <summary>
        /// 解析章节列表
        /// </summary>
        [Description("解析章节列表")]
        Parse,

        /// <summary>
        /// 下载章节
        /// </summary>
        [Description("下载章节")]
        Chapter,

        /// <summary>
        /// 下载小说
        /// </summary>
        [Description("下载小说")]
        Download,

        /// <summary>
        /// 写出小说
        /// </summary>
        [Description("写出小说")]
        Write,
    }
}